package com.wookii.friedeggs.data

import androidx.room.Embedded
import androidx.room.Entity
import androidx.room.Ignore
import androidx.room.PrimaryKey
import androidx.room.Relation
import com.wookii.friedeggs.utils.getFullDate

/**
 *@Author Nick.wu
 *Date 2023/9/25
 */

/**
 * 一对多关系
 */
data class ExamStudent(
    @Embedded val exam: Exam,
    @Relation(parentColumn = "id", entityColumn = "examId")
    val students: List<Student>
)
@Entity
data class Exam(
    @PrimaryKey(autoGenerate = true) val id: Int?,
    @Embedded var classInfo: Class? = null,
    val isFinished: Boolean = false,
    val create: Long
) {
}

@Entity
data class Student(
    @PrimaryKey(autoGenerate = true) val id: Int?,
    val name: String,
    val examId: Long?,
    @Embedded var classInfo: Class? = null,
    @Embedded val teacherInfo: Teacher? = null,
) {
    @Ignore var isChecked: Boolean = false
}

@Entity
data class Class(
    @PrimaryKey(autoGenerate = true) val classId: Int?,
    val className: String,
    val classCreate: Long = System.currentTimeMillis()

)

@Entity
data class Teacher(
    @PrimaryKey val teacherId: Int,
    val teacherName: String
)